#ifndef TH_ISB310_I_H
#define TH_ISB310_I_H

#include <QMainWindow>
#include <QUdpSocket>
#include <QTimer>
#include <QKeyEvent>

namespace Ui
{
class TH_ISB310_I;
}

class TH_ISB310_I : public QMainWindow
{
    Q_OBJECT

public:
    //半自动闭塞电压电流采集模块的数值结构体定义
    struct _dataFrame {
        float voltage1;
        float voltage2;

        //默认构造函数
        _dataFrame() {
            voltage1 = 0;
            voltage2 = 0;
        }
    };
    typedef _dataFrame DataFrame;   //定义结构体数据类型DataFrame;

public:
    explicit TH_ISB310_I(QWidget *parent = 0);
    ~TH_ISB310_I();
    static DataFrame toDataFrame(QByteArray dat);

protected:
    void keyPressEvent(QKeyEvent *event);

private:
    void initialize();
    void setDisplay(DataFrame data);
    void clearDisplay();
    void readConfig();
    void writeConfig();
    void startOneTest();
    void loadName();
    void setName(unsigned int arg);

private slots:
    void on_pushButton();
    void on_remoteIPChanged();
    void on_testTimeout();
    void on_spinBoxChanged(int arg);
    void on_socketReceive();
    void on_AutoTest();

private:
    Ui::TH_ISB310_I *ui;
    QByteArray arrayData;
    QUdpSocket socket;
    QTimer time;
    QHash<int,QString> name;

};

#endif // TH_ISB310_I_H
